﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_ACEIndex.cshtml";
}
@this.Partial("Index-js")

<div class="topPanel">
    <div class="toolbar">
        <div class="btn-group">
            <a class="btn btn-primary" onclick="$ace.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
        </div>
        <div class="btn-group">
            <button class="btn btn-primary" data-bind="click:ProcessDesign,attr:{disabled:!DataTable.SelectedModel()}"><i class="fa fa-pencil-square-o"></i>设计流程</button>
            <button class="btn btn-primary" data-bind="click:Edit,attr:{disabled:!DataTable.SelectedModel()}"><i class="fa fa-pencil-square-o"></i>修改</button>
            <button class="btn btn-primary" data-bind="click:Delete,attr:{disabled:!DataTable.SelectedModel()}"><i class="fa fa-trash-o"></i>删除</button>
            <button class="btn btn-primary" data-bind="click:Add"><i class="fa fa-plus"></i>添加</button>
             <button class="btn btn-primary" data-bind="click:Detail,attr:{disabled:!DataTable.SelectedModel()}"><i class="fa fa-pencil-square-o"></i>详情</button>

        </div>
    </div>
    <div class="search">
        <table>
            <tr>
                <td>
                    <div class="input-group">
                        <input id="txt_keyword" type="text" class="form-control" placeholder="名称/编号" style="width: 200px;" data-bind="value:SearchModel().keyword">
                        <span class="input-group-btn">
                            <button id="btn_search" type="button" class="btn  btn-primary" data-bind="click:Search"><i class="fa fa-search"></i></button>
                        </span>
                    </div>
                </td>
            </tr>
        </table>
    </div>
</div>

<div class="table-responsive">
    <table class="table table-hover" data-bind="with:DataTable">
        <thead>
            <tr>
                <th style="width:20px;"></th>
                <th>id</th>
                <th>工作流名称</th>
                <th>工作描述</th>
                <th>工作流标识</th>
                <th>业务表</th>
                <th>工作流映射表</th>
                <th>工作流状态</th>
                <th>锁定状态</th>
                <th>业务表字段</th>
                <th>开始时间</th>
                <th>结束时间</th>
            </tr>
        </thead>

        <tbody data-bind="foreach:Models">
            <tr data-bind="click:$parent.SelectRow">
                <td data-bind="text:$parent.GetOrdinal($index())"></td>
                <td data-bind="text:id"></td>
                <td data-bind="text:wfname"></td>
                <td data-bind="text:wfmemo"></td>
                <td data-bind="text:wfflag"></td>
                <td data-bind="text:wfownertable"></td>
                <td data-bind="text:wfinstancestable"></td>
                <td data-bind="text:wfstatus()==1?'已启用':'未启用'"></td>
                <td data-bind="text:wflock()==1?'未锁定':'锁定'"></td>
                <td data-bind="text:wffieldname"></td>
                <td data-bind="dateString:wfbegintime"></td>
                <td data-bind="dateString:wfstoptime"></td>
            </tr>
        </tbody>
        @this.Partial("_tfoot")
    </table>
</div>


@using (Html.Dialog())
{

    <form id="form1">
        <div style="margin-top: 10px; margin-left: 10px; margin-right: 10px;">
            <div style="padding-top: 20px; margin-right: 30px;">
                <table class="form"> 
                    <tr>
                        <td class="formTitle">名称</td>
                        <td class="formValue">
                            <input id="wfname" name="wfname" type="text" class="form-control" data-bind="value:Model().wfname" />
                        </td>                       
                    </tr>
                    <tr>
                       <td class="formTitle">工作流描述</td>
                        <td class="formValue">
                            <input id="wfmemo" name="wfmemo" type="text" class="form-control" data-bind="value:Model().wfmemo" />
                        </td> 
                    </tr>
                    <tr>
                        <td class="formTitle">标识</td>
                        <td class="formValue">
                            <input id="wfflag" name="wfflag" type="text" class="form-control" data-bind="value:Model().wfflag" />
                        </td>                       
                    </tr>
                    <tr>
                       <td class="formTitle">业务表</td>
                        <td class="formValue">
                            <input id="wfownertable" name="wfownertable" type="text" class="form-control" data-bind="value:Model().wfownertable" />
                        </td> 
                    </tr>
                     <tr>
                       <td class="formTitle">业务表工作流字段</td>
                        <td class="formValue">
                            <input id="wffieldname" name="wffieldname" type="text" class="form-control" data-bind="value:Model().wffieldname" />
                        </td> 
                    </tr>
                    <tr>                        
                        <td class="formTitle">影子表</td>
                        <td class="formValue">
                            <input id="wfinstancestable" name="wfinstancestable" type="text" class="form-control" data-bind="value:Model().wfinstancestable" />
                        </td>
                    </tr>
                    <tr>
                        <td class="formTitle">状态</td>
                        <td class="formValue">
                          @*  <input id="wfstatus" name="wfstatus" type="text" class="form-control" data-bind="value:Model().wfstatus" />
                       *@
                             <select id="wfstatus" name="wfstatus" class="form-control " data-bind="value:Model().wfstatus">
                            <option value="1" selected="selected" >已启用</option>
                            <option value="2">未启用</option>
                        </select>
                        </td>                       
                    </tr>
                    <tr>
                        <td class="formTitle">锁定状态</td>
                        <td class="formValue">
                           @* <input id="wflock" name="wflock" type="text" class="form-control" data-bind="value:Model().wflock" />
                      *@
                            <select id="wflock" name="wflock" class="form-control " data-bind="value:Model().wflock">
                            <option value="1" selected="selected" >未锁定</option>
                            <option value="2">已锁定</option>
                        </td>                       
                    </tr>
                    
                     <tr>
                       <td class="formTitle">开始时间</td>
                        <td class="formValue">
                            <input id="wfbegintime" name="wfbegintime" type="text" class="form-control input-wdatepicker Wdate" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" data-bind="value:Model().wfbegintime" />
                        </td> 
                    </tr>
                     <tr>
                       <td class="formTitle">结束时间</td>
                        <td class="formValue">
                            <input id="wfstoptime" name="wfstoptime" type="text" class="form-control input-wdatepicker Wdate" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" data-bind="value:Model().wfstoptime" />
                        </td> 
                    </tr>
                </table>
            </div>
        </div>
    </form>


}
@using (Html.Dialog("DetailDialog", "DetailDialog", 800))
{
         <form id="DetailForm">
        <div style="margin-top: 10px; margin-left: 10px; margin-right: 10px;">
            <div style="padding-top: 20px; margin-right: 30px;">
                <table class="form">
                    <tr>
                        <td class="formTitle">名称：</td>
                        <td class="formValue">
                           <label class="form-control" data-bind="text:Model().wfname"></label>
                        </td>
                        <td class="formTitle">工作流描述:</td>
                        <td class="formValue">
                            <label class="form-control" data-bind="text:Model().wfmemo"></label>
                        </td>
                    </tr>
                    <tr>
                        <td class="formTitle">标识：</td>
                        <td class="formValue">
                            <label class="form-control" data-bind="text:Model().wfflag"></label>
                        </td>
                        <td class="formTitle">业务表：</td>
                        <td class="formValue">
                            <label class="form-control" data-bind="text:Model().wfownertable"></label>
                        </td>
                    </tr>
                  <tr>
                        <td class="formTitle">业务表工作流字段：</td>
                        <td class="formValue">
                            <label class="form-control" data-bind="text:Model().wffieldname"></label>
                        </td>
                        <td class="formTitle">影子表：</td>
                        <td class="formValue">
                            <label class="form-control" data-bind="text:Model().wfinstancestable"></label>
                        </td>
                    </tr>

                        <tr>
                        <td class="formTitle">状态：</td>
                        <td class="formValue">
                            <label class="form-control" data-bind="text:Model().wfstatus==1?'已启用':'未启用'"></label>
                        </td>
                        <td class="formTitle">锁定状态：</td>
                        <td class="formValue">
                            <label class="form-control" data-bind="text:Model().wflock==1?'未锁定':'锁定' "></label>
                        </td>
                    </tr>
                            <tr>
                        <td class="formTitle">开始时间：</td>
                        <td class="formValue">
                            <label class="form-control" data-bind="dateString:Model().wfbegintime"></label>
                        </td>
                        <td class="formTitle">结束时间：</td>
                        <td class="formValue">
                            <label class="form-control" data-bind="dateString:Model().wfstoptime"></label>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </form>
}
